package controllers;

import utils.CommonUtil;

import javax.swing.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

/**
 * @version V1.0
 * @Title: 按钮组件处理类
 * @Package
 * @Description: 给下拉框选项按钮组件添加hover效果
 * @author: GaleBlade
 * @date:
 */
public class ComboButtonControl extends MouseAdapter {

	private JButton btn;

	public ComboButtonControl(JButton btn) {

		this.btn = btn;

	}

	@Override
	public void mouseClicked(MouseEvent e) {
	}

	/**
	 * 鼠标移进选项时，设置选项边框
	 */
	@Override
	public void mouseEntered(MouseEvent e) {
		this.btn.setBorder(BorderFactory.createLineBorder(CommonUtil.color, 1, true));
	}

	/**
	 * 鼠标移出选项时，设置选项边框为null
	 */
	@Override
	public void mouseExited(MouseEvent e) {
		this.btn.setBorder(null);
	}

	@Override
	public void mouseDragged(MouseEvent e) {
//		System.out.println("mouseDragged");
	}

	@Override
	public void mouseMoved(MouseEvent e) {
	}

	@Override
	public void mousePressed(MouseEvent e) {
	}

	@Override
	public void mouseReleased(MouseEvent e) {
	}
}
